Skip to content

fix(worktree): Fix plugin cache race condition and TypeScript check cwd - #330

Merged
sylvansys merged 1 commit into
mainfrom
claude-vivid-toucan-b4bcmf1h
Jan 29, 2026
Merged

fix(worktree): Fix plugin cache race condition and TypeScript check cwd#330
sylvansys merged 1 commit into
mainfrom
claude-vivid-toucan-b4bcmf1h

Conversation

@sylvansys

Copy link
Copy Markdown
Collaborator

Summary

  • Fix plugin cache symlink timing - Move symlink update AFTER plugin installation to prevent hooks from executing against empty cache directories
  • Fix TypeScript hook working directory - Normalize cwd to worktree/repo root using detectWorktree to fix false positives in monorepos
  • Enable github-orchestration plugin - Was missing from settings

Test plan

  • Create a new worktree with cw command
  • Verify SessionStart hooks execute without "module not found" errors
  • Run a full session and verify Stop hook TypeScript check works
  • Test in monorepo to verify false positives are gone

Fixes #329

🤖 Generated with Claude Code

- Move symlink update AFTER plugin installation to prevent hooks from
  executing against empty cache directories
- Normalize TypeScript hook cwd to worktree/repo root using detectWorktree
  to fix false positives in monorepos where input.cwd is a subdirectory
- Enable github-orchestration plugin in settings

Fixes #329

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

PR feedback updates from your reviewer agents. Based on linked issues, context files, and committed changes.

Code Quality: ✅ 3 • ❌ 1 • ⏭️ 0
Check Status Reasoning
DRY Compliance Significant code duplication between run-session-typechecks.ts and run-task-typechecks.ts. Both files share identical: truncateOutput function (lines 28-36), timeout constant (60000ms), max output constant (500 chars), tsc execution logic (lines 85-104 vs 128-147), error handling pattern, and debug logging structure.
Files (4)
plugins/nextjs-supabase-ai-sdk-dev/hooks/run-session-typechecks.ts:28 - truncateOutput function duplicated in both files
plugins/nextjs-supabase-ai-sdk-dev/hooks/run-session-typechecks.ts:85 - tsc execution and error handling logic duplicated
plugins/nextjs-supabase-ai-sdk-dev/hooks/run-task-typechecks.ts:32 - Duplicate truncateOutput function
plugins/nextjs-supabase-ai-sdk-dev/hooks/run-task-typechecks.ts:128 - Duplicate tsc execution and error handling logic
YAGNI Compliance No speculative features detected. The worktree script implements needed features (auto-update, cache management, cleanup) that are actively used. The TypeScript hooks implement simple, focused checks without unnecessary abstraction. The settings.json contains only configuration for actually used plugins and tools.
Modularity Good separation of concerns. The worktree script logically groups functionality into distinct helper functions (_cw_find_repo, _cw_plugin_content_hash, etc.). TypeScript hooks are separate files for different lifecycle events. Shared utilities are imported from ../shared/. Each component has a clear, single responsibility.
Maintainability Code is generally well-structured and readable. The bash script uses clear section headers and helper functions with descriptive names. TypeScript hooks have clear documentation comments and consistent structure. Debug logging aids troubleshooting. Error messages are informative. The duplication issue affects maintainability but doesn't make the code unreadable.

@sylvansys
sylvansys merged commit c9be2bb into main Jan 29, 2026
4 of 7 checks passed
@sylvansys
sylvansys deleted the claude-vivid-toucan-b4bcmf1h branch January 29, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run-session-typechecks hook reports false positive TypeScript errors

1 participant